home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / initreq.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  2.0 KB  |  78 lines

  1. /*
  2.  * initreq.h    Interface to talk to init through /dev/initctl.
  3.  *
  4.  *        Copyright (C) 1995-2004 Miquel van Smoorenburg
  5.  *
  6.  *        This library is free software; you can redistribute it and/or
  7.  *        modify it under the terms of the GNU Lesser General Public
  8.  *        License as published by the Free Software Foundation; either
  9.  *        version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * Version:     @(#)initreq.h  1.28  31-Mar-2004 MvS
  12.  *
  13.  */
  14. #ifndef _INITREQ_H
  15. #define _INITREQ_H
  16.  
  17. #include <sys/param.h>
  18.  
  19. #if defined(__FreeBSD_kernel__)
  20. #  define INIT_FIFO  "/etc/.initctl"
  21. #else
  22. #  define INIT_FIFO  "/dev/initctl"
  23. #endif
  24.  
  25. #define INIT_MAGIC 0x03091969
  26. #define INIT_CMD_START        0
  27. #define INIT_CMD_RUNLVL        1
  28. #define INIT_CMD_POWERFAIL    2
  29. #define INIT_CMD_POWERFAILNOW    3
  30. #define INIT_CMD_POWEROK    4
  31. #define INIT_CMD_BSD        5
  32. #define INIT_CMD_SETENV        6
  33. #define INIT_CMD_UNSETENV    7
  34.  
  35. #define INIT_CMD_CHANGECONS    12345
  36.  
  37. #ifdef MAXHOSTNAMELEN
  38. #  define INITRQ_HLEN    MAXHOSTNAMELEN
  39. #else
  40. #  define INITRQ_HLEN    64
  41. #endif
  42.  
  43. /*
  44.  *    This is what BSD 4.4 uses when talking to init.
  45.  *    Linux doesn't use this right now.
  46.  */
  47. struct init_request_bsd {
  48.     char    gen_id[8];        /* Beats me.. telnetd uses "fe" */
  49.     char    tty_id[16];        /* Tty name minus /dev/tty      */
  50.     char    host[INITRQ_HLEN];    /* Hostname                     */
  51.     char    term_type[16];        /* Terminal type                */
  52.     int    signal;            /* Signal to send               */
  53.     int    pid;            /* Process to send to           */
  54.     char    exec_name[128];            /* Program to execute           */
  55.     char    reserved[128];        /* For future expansion.        */
  56. };
  57.  
  58.  
  59. /*
  60.  *    Because of legacy interfaces, "runlevel" and "sleeptime"
  61.  *    aren't in a seperate struct in the union.
  62.  *
  63.  *    The weird sizes are because init expects the whole
  64.  *    struct to be 384 bytes.
  65.  */
  66. struct init_request {
  67.     int    magic;            /* Magic number                 */
  68.     int    cmd;            /* What kind of request         */
  69.     int    runlevel;        /* Runlevel to change to        */
  70.     int    sleeptime;        /* Time between TERM and KILL   */
  71.     union {
  72.         struct init_request_bsd    bsd;
  73.         char            data[368];
  74.     } i;
  75. };
  76.  
  77. #endif
  78.